package cn.edu.gzmtu.dao;

import cn.edu.gzmtu.domain.Traveller;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 旅客
 */
@Repository
public interface ITravellerDao {

    /**
     * 根据id查询
     * @param id
     * @return
     * @throws Exception
     */
    @Select("select * from traveller where id=#{id}")
    Traveller findById(String id) throws Exception;

    /**
     * 根据订单查询旅客
     * @param ordersId
     * @return
     * @throws Exception
     */
    @Select("select * from traveller where id in (select travellerId from order_traveller where orderId=#{ordersId})")
    List<Traveller> findByOrdersId(String ordersId) throws Exception;
}
